package com.gnerv.plug.maven.model;

import com.gnerv.plug.maven.DependencyGroupAction;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.util.xml.ui.DomCollectionControl;

import java.util.ArrayList;
import java.util.List;

public class DependencyInfoList {

    public static List<DependencyInfo> DEPENDENCYINFOS = new ArrayList<>();

    public static String jsonString = "";

    static {
        jsonString = "[{\"groupId\":\"com.baomidou\",\"artifactId\":\"mybatis-plus-boot-starter\",\"versions\":[\"3.3.2\",\"3.3.1\"]},\n" +
                "{\"groupId\":\"org.springframework.boot\",\"artifactId\":\"spring-boot-starter-web\",\"versions\":[\"42.2.14\"]},\n" +
                "{\"groupId\":\"org.postgresql\",\"artifactId\":\"postgresql\",\"versions\":[\"2.8.6\"]}]";
        initAction(jsonString);
    }

    public static void initAction(String jsonString){
        Gson gson = new Gson();
        DEPENDENCYINFOS = gson.fromJson(jsonString, new TypeToken<List<DependencyInfo>>() {
        }.getType());
    }

}
